# _*_coding:utf-8_*_
# 作者    ：SunDuWei
# 创作时间 ：2020-02-18
import json


def basic_info_config(path):
    # 基础信息导入
    f = open(path)
    config = json.load(f)
    f.close()
    data_io = config['data_io']
    kind = config['basicinfo']['kind']
    kind_min = config['basicinfo']['kind_min']
    day_main_io = data_io % (kind, kind, 'day', '')
    day_second_io = data_io % (kind, kind, 'day', '_second')
    day_min_io = data_io % (kind, kind, kind_min, '')
    return data_io, day_main_io, day_second_io, day_min_io, kind, kind_min


def x1_factor_config(path):
    # x1类因子数据导入
    f = open(path)
    config = json.load(f)
    f.close()
    macd_param = config['x1_param']['macd_param']
    kdj_param = config['x1_param']['kdj_param']
    rsi_param = config['x1_param']['rsi_param']
    boll_param = config['x1_param']['boll_param']
    return macd_param, kdj_param, rsi_param, boll_param


def y1_factor_config(path):
    # x1类因子数据导入
    f = open(path)
    config = json.load(f)
    f.close()
    y1_param_day = config['y1_param']['y1_param_day']
    y1_param_min = config['y1_param']['y1_param_min']

    return y1_param_day, y1_param_min


if __name__ == '__main__':
    path = r'E:\课堂资料\future\config.json'
    data_io, day_main_io, day_second_io, day_min_io, kind, kind_min = basic_info_config(path)
    macd_param, kdj_param, rsi_param, boll_param = x1_factor_config(path)
    y1_param_day, y1_param_min = y1_factor_config(path)
    print(kind)
    print(rsi_param)
    print(y1_param_day)